package yto.freemarker.springcloud.controller;

import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import yto.freemarker.springcloud.entity.User;
import yto.freemarker.springcloud.service.UserService;

import java.util.List;
import java.util.Map;

/**
 * @author dongxing
 * @create 2018-02-27 22:16
 **/
@RestController
@AllArgsConstructor(onConstructor = @_(@Autowired))
public class UserController {

    private final UserService userService;

    @GetMapping("/user/{id}")
    public User findById(@PathVariable String id) {
        return userService.getUserById(id);
    }

    @PostMapping("/user/a")
    public User postUser(User user){
        return userService.postUser(user);
    }

}
